package com.zhuss.controller.product;

import com.zhuss.bean.bo.product.train.CreateLineStrategyBo;
import com.zhuss.bean.bo.product.train.DetailLineStrategyBo;
import com.zhuss.bean.bo.product.train.SearchLineStrategyBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.exception.DzcxException;
import com.zhuss.product.train.LineStrategyReadServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @description: 线路策略查询Controller
 * @author: zhushanshuo
 * @create: Mon Jan 04 09:51:07 CST 2021
 **/
@RestController
@RequestMapping("/lineStrategy")
public class LineStrategyReadController extends BaseController {

	@Autowired
	@Qualifier("lineStrategyReadService")
	private ReadService<Object, Object> lineStrategyReadService;

	@Autowired
	@Qualifier("lineStrategyReadServiceExt")
	private LineStrategyReadServiceExt lineStrategyReadServiceExt;

	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailLineStrategyBo bo) throws DzcxException {

		Object result = lineStrategyReadService.detail(bo);
		return result;
    }

	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchLineStrategyBo bo) throws DzcxException {

		Object result = lineStrategyReadService.list(bo);
		return result;
    }

	/**
	 * 校验班次是否存在
	 * @param bo
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/check")
	public Object checkTrain(@RequestBody CreateLineStrategyBo bo) throws DzcxException {
		Object result = lineStrategyReadServiceExt.checkTrain(bo);
        return result;
	}

	/**
	 * 根据策略id查询站点信息
	 */
	@ResponseBody
	@RequestMapping("/getSiteList")
	public Object getSiteList(@RequestBody DetailLineStrategyBo bo) throws DzcxException {
		Object result = lineStrategyReadServiceExt.getSiteList(bo);
		return result;
	}

}
